package day_08;

public class Student {
    //对学生的属性进行定义
    private String name;
    private int age;
    private String id;
    //空参构造法，虚拟机自动生成
//    public Student(){
//    }
    //带参构造法，需要收到写
    public Student(String name,int age,String id){
        this.name=name;
        this.age=age;
        this.id=id;
    }

    public void getname(String name) {
        this.name=name;
    }
    public String putname(){
        return this.name;
    }
    public void getage(int age) {
        if(age>=6&&age<=18){
            this.age=age;
        }
        else {
            System.out.println("年龄超出范围");
        }
    }
    public int putage(){
        return this.age;
    }
    public void getid(String id) {
        this.id=id;
    }
    public  String putid(){
        return this.id;
    }
    //对学生的行为进行定义
    public void study(){
        System.out.println(name+"在学习");
    }
    public  void sleep(){
        System.out.println(name+"在睡觉");
    }
}
